package com.hspedu.newData.每日一题;

import org.junit.Test;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-10 
 * @Version: 1.0
 */

public class LC2269找到一个数字的k美丽值 {

    // todo 效率不高
    public int divisorSubstrings(int num, int k) {

        String s = num + "";


        int length = s.length();

        int count = 0;
        for (int i = 0; i < length - k + 1; i++) {
            String substring = s.substring(i, i + k);

            int i1 = Integer.parseInt(substring);
            if (i1 != 0 && num%i1 == 0){
                count++;
            }
        }

        return count;
    }

    @Test
    public void test() {
        // 测试代码

        divisorSubstrings(430043,2);
    }
}
